package fxy.fxyOffer;


public class Solution {
	/**
	 * �ж��Ƿ�Ϊ˳��
	 * ���ظ��Ĵ�
	 * max - min >= 5;
	 * @param numbers
	 * @return
	 */
    public boolean isContinuous(int [] numbers) {
    	int []array = new int[14];
    	int min = 14;
    	int max = -1;
    	int len = numbers.length;
    	if(len > 5 || len <= 0){
    		return false;
    	}
    	for(int i = 0 ; i < len; i++){
    		if(numbers[i] == 0){
    			continue;
    		}
    		if(numbers[i] < 0 || numbers[i] > 13 || array[numbers[i]] != 0   ){
    			return false;
    		}
    		array[numbers[i]] ++;
    		if(numbers[i] < min){
    			min = numbers[i];
    		}else if(numbers[i] > max ){
    			max = numbers[i];
    		}
    	}
    	if(max - min<5 ){
    	    return true; 
    	}
		return false;
    }
    public int Sum_Solution(int n) {
    	if(n == 1){
    		return 1;
    	}
    	return n + Sum_Solution(n-1);
    }
    public int Add(int num1,int num2) {
        return num1 ^ num2;
    }
    public static void main(String[] args) {
//    	int [] numbers = {3,0,0,0,0};
//    	System.out.println("   "+(new Solution()).isContinuous(numbers));
    	System.out.println("   "+(new Solution()).Sum_Solution(100));
	}
}
